<div class="header">
    <div class="container">
        <div class="row header_box">
            <a href="index.html"><img src="/pay/images/logo.png" class="pull-left logo" /></a>
            <div class="pull-right call">
                <ul>
                    <li class="border_rt">
                        <i class="icon iconfont"></i>
                        24小时服务热线<br/>18125901841
                    </li>
                    <li class="play">
                        微信关注<br/>下载APP
                        <div class="play_box animated">

                            <div class="pull-left box">
                                <h4>下载APP</h4>
                                <img src="/pay/images/mg.png" />
                            </div>
                            <div class="clear"></div>
                            <span></span>
                        </div>
                    </li>
                </ul>
            </div>
        </div>
    </div>
    <div class="nav_box">
        <div class="container warp">
            <ul class="pull-left">
                <li id="li_index">
                    <a href="/pay/index.html">
                        <i class="icon iconfont">&#xe606;</i>
                        网站首页
                    </a>
                </li>
                <li id="li_serve">
                    <a href="/pay/serve.html">
                        <i class="icon iconfont">&#xe634;</i>
                        资费套餐
                    </a>
                </li>
                <li id="li_help">
                    <a href="/pay/help.html">
                        <i class="icon iconfont">&#xe6cb;</i>
                        接入文档
                    </a>
                </li>
                <li id="li_appset">
                    <a href="/pay/appset.html">
                        <i class="icon iconfont">&#xe640;</i>
                        app设置
                    </a>
                </li>

                <li id="li_leavemsg" >
                    <a href="/pay/leavemsg.html">
                        <i class="icon iconfont">&#xe66c;</i>
                        留言与建议
                    </a>
                </li>

                <div class="clear"></div>
            </ul>
            <div class="logoin pull-right" id="div_nouser" style="display:none;">
                <a href="/pay/login.html"  id="a_login">
                    <i class="icon iconfont">&#xe60c;</i>
                    登录
                </a>
                <a href="/pay/enroll.html" id="a_enroll">
                    <i class="icon iconfont" >&#xe697;</i>
                    注册
                </a>
            </div>
            <div class="logoin pull-right" id="div_user" style="display:none;">
                <a href="/pay/work/index.html" class="ac">
                    <i class="icon iconfont">&#xe60c;</i>
                    商户管理
                </a>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript">

    var url = window.location.href;
    if(url.indexOf("help")>0){
        $('#li_help').attr({"class" : "ac"});
    }else if(url.indexOf("serve")>0){
        $('#li_serve').attr({"class" : "ac"});
        //alert($('#li_serve'));
    }else if(url.indexOf("appset")>0){
        $('#li_appset').attr({"class" : "ac"});
    }else if(url.indexOf("work")>0){
        $('#li_work').attr({"class" : "ac"});
    }else if(url.indexOf("leavemsg")>0){
        $('#li_leavemsg').attr({"class" : "ac"});
    }else{
        $('#li_index').attr({"class" : "ac"});
    }


    if(url.indexOf("enroll")>0){
        $('#a_enroll').attr({"class" : "ac"});
        $('#a_login').attr({"class" : ""});
    }else{
        $('#a_login').attr({"class" : "ac"});
    }


    var is_login = false;
    function getUser_islogin(){
        var cookie_login = $.cookie("user_is_login");
        if(cookie_login=="true"){
            is_login = true;
            return;
        }else if(cookie_login=="false"){
            is_login = false;
            return;
        }else{
            get_service_login();
        }
    }

    function get_service_login(){
        $.ajax(
            {
                type: 'post',
                url: '/api/sys/login/getLoginUser',
                async:true,
                cache:false,
                dataType:'json',
                success: function(ret){
                    if(ret.success){
                        $.cookie("user_is_login","true",{path:"/"});
                    }else{
                        $.cookie("user_is_login","false",{path:"/"});
                    }
                },
                error:function(){

                }
            });
    }

    getUser_islogin();
    if(is_login){
        $('#div_user').show();
        $('#div_nouser').hide();
    }else{
        $('#div_user').hide();
        $('#div_nouser').show();
    }
</script>